Chapter 9 Main Memory

Chapter 9 Main Memory

Background

基礎硬體

  • 架構

    alt text

  • 每次的記憶體存取

    alt text

Address binding

  • 地址綁定

    alt text
    alt text
    alt text
    alt text
    alt text

  • 使用者程式的不同階段

    alt text
    alt text

    • 多數作業系統使用 執行時綁定

物理 跟 邏輯位址的差異

  • 比較

    alt text
    alt text
    alt text
    alt text
    alt text
    alt text

  • 不同時期的差異

    alt text
    alt text
    alt text
    alt text
    alt text

Memory-Management Unit (MMU)

  • 硬體

    alt text
    alt text

  • 動態分配得過程圖

    alt text

  • 動態加載

    alt text
    alt text

  • 動態連接

    alt text
    alt text
    alt text

    • 需要支援

      alt text
      alt text

Swapping

  • 換頁

    alt text
    alt text
    alt text

  • 換頁限制 time cost

    alt text
    alt text
    alt text

Contiguous Memory Allocation

  • 記憶體分配

    alt text
    alt text

  • 連續的分配

    alt text
    alt text

    • alt text

  • 例子

    alt text
    alt text

找洞策略

  • 三種方式

    alt text
    alt text
    alt text

  • 碎片化 (Fragmentation)

    alt text
    alt text
    alt text
    alt text
    alt text

Paging

  • 分頁 (Paging)

    alt text
    alt text
    alt text

  • paging model

    alt text

硬體實現

alt text

  • Example
    • 4 byte page

      alt text

如何決定page size

  • size

    alt text
    alt text

分配frame 給process

alt text

分頁的功能與特點

alt text
alt text

實現頁表 (Implementation of Page Table)

alt text
alt text
alt text
alt text

TLB (轉譯後備緩存)

alt text
alt text

  • 硬體架構圖

    alt text

TLB 未命中 (TLB Miss)

alt text
alt text

TLB 和上下文切換

alt text
alt text

有效訪問時間 (EAT) 解釋

alt text
alt text
alt text

記憶體保護

alt text
alt text
alt text

  • 有效存取 圖

    alt text

PTE中的有效/無效位

alt text
alt text
alt text

共享程式碼頁面

alt text
alt text
alt text
alt text
alt text
alt text

Structure of the Page Table

alt text

Hierarchical Page Tables

alt text
alt text
alt text
alt text
alt text

  • alt text
    alt text

  • 但會增加記憶體存取的次數

    alt text

  • Example

    alt text

  • 64位系統

    alt text
    alt text
    alt text
    alt text
    alt text

Hashed Page Tables

alt text
alt text
alt text
alt text

  • alt text

Inverted Page Table

alt text
alt text
alt text
alt text
alt text
alt text
alt text

  • 結構圖

    alt text

  • 問題

    alt text
    alt text
    alt text
    alt text
    alt text

Segmentation

alt text
alt text
alt text
alt text
alt text

使用者視角

alt text

Segmentation 的定義與過程

alt text
alt text
alt text
alt text

邏輯視角

alt text

Segmentation Hardware 的組成與運作

alt text
alt text
alt text
alt text
alt text

  • 例子

    alt text

  • 優勢

    alt text

  • 挑戰

    alt text

硬體設計

alt text
alt text
alt text
alt text
alt text
alt text

  • 總結

    alt text

  • Example

    alt text

Examples: Intel and ARM Architectures

  • 連接

    alt text
    alt text
    alt text

PAE

alt text
alt text
alt text
alt text
alt text
alt text

Intel x86

alt text

ARM

alt text
alt text
alt text
alt text
alt text
alt text
alt text


Chapter 9 Main Memory
https://z-hwa.github.io/webHome/[object Object]/Operation Systems/Chapter-9-Main-Memory/
作者
crown tako
發布於
2025年1月9日
許可協議